package com.play.airfight.bullets;

import com.play.airfight.GlobalInfo;
import com.play.airfight.managers.Player;
import com.play.airfight.utils.UiUtils;

/**
 * 我的子弹
 */
public class MyBullet extends BulletsContract {
    //    public int currentX = GlobalInfo.screenW / 2;
//    public int currentY = GlobalInfo.screenH - 150;

    public int speed = GlobalInfo.player_bullet_speed; // 子弹默认的初始速度
    public boolean isGone = false; // 子弹是否消失

    public int width = UiUtils.dip2Pixel(6);
    public int height = UiUtils.dip2Pixel(20);

    public MyBullet() {
        currentX = Player.currentX;
        currentY = Player.currentY;
    }

    // 子弹飞行逻辑
    public void fly() {
        if (isGone) {
            return;
        }
        currentY -= speed;
        if (currentY <= -100) {
            // 子弹超出屏幕顶部一百像素  视为消失
            isGone = true;
        }
    }


}
